package sctu.edu.java.year2016.team01.OurTeamProject.mainProgram;


import sctu.edu.java.year2016.team01.OurTeamProject.subroutine.Login;
import sctu.edu.java.year2016.team01.OurTeamProject.subroutine.Register;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Created by Zero on 2016/6/22.
 */
public class ComputerSystem {

    public static void main(String[] args) {

        Register register1=new Register();
        Login login1=new Login();
        String path="src\\main\\java\\sctu\\edu\\java\\year2016\\team01\\OurTeamProject";
        JFrame f = new JFrame();
        f.setLayout(null);
        f.setTitle("运维平台客户端程序");
        f.setBounds(800, 300, 400, 500);
        Container con = f.getContentPane();
        JPanel pan = new JPanel();

        JLabel title=new JLabel("运维平台客户端程序");
        title.setFont(new Font("宋体", Font.BOLD, 21));
        title.setForeground(Color.white);


        ImageIcon background=new ImageIcon(path+"\\背景.png");
        JLabel label=new JLabel(background);
        label.setBounds(0, 0, 400, 500);
        JPanel imagePanel = (JPanel) f.getContentPane();
        imagePanel.setOpaque(false);
        f.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE));



        JButton login=new JButton("登录");
        login.setFont(new Font("宋体", Font.BOLD, 19));
        login.setContentAreaFilled(false);
        login.setForeground(Color.white);
        login.setBounds(150, 200, 100, 30);

        JButton register=new JButton("注册");
        register.setFont(new Font("宋体", Font.BOLD, 19));
        register.setContentAreaFilled(false);
        register.setForeground(Color.white);
        register.setBounds(150, 250, 100, 30);


        JButton exit=new JButton("退出");
        exit.setFont(new Font("宋体", Font.BOLD, 19));
        exit.setContentAreaFilled(false);
        exit.setForeground(Color.white);
        exit.setBounds(150, 300, 100, 30);



        f.getContentPane().add(title);
        f.getContentPane().add(login);
        f.getContentPane().add(register);
        f.getContentPane().add(exit);
        title.setBounds(100, 50, 200, 200);





        login.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {


                try {


                    login1.setUp();


                } catch (Exception e1) {
                    e1.printStackTrace();
                }

            }
        });


        register.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                try {

                    register1.setUp();


                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        });



        exit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });




        f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        con.add(pan);
        f.setVisible(true);

    }
}
